// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   TELImpl.java

package com.sunwayhorizo.health.hl7.datatypes.common;

import com.sunwayhorizo.health.hl7.common.Hl7Exception;
import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.ANY;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.GTS;
import com.sunwayhorizo.health.hl7.datatypes.SET_CS;
import com.sunwayhorizo.health.hl7.datatypes.ST;
import com.sunwayhorizo.health.hl7.datatypes.TEL;
import com.sunwayhorizo.health.hl7.datatypes.TYPE;


// Referenced classes of package oracle.apps.ctb.hl7.types.common:
//            URLImpl, ANYImpl, CSImpl, GTSBase, 
//            GTSNullImpl, NullFlavorImpl, SETCommonImpl, SET_CSImpl, 
//            STImpl, TYPEImpl

public class TELImpl extends URLImpl
    implements TEL
{

    public static final String RCS_ID = "$Header: TELImpl.java 115.27 2005/09/16 09:23:00 amchanda noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header: TELImpl.java 115.27 2005/09/16 09:23:00 amchanda noship $", "oracle.apps.ctb.hl7.types.common");
    public static final String VALUE = "value";
    public static final String USE = "use";
    public static final String USEABLEPERIOD = "useablePeriod";
    private GTS mUsabilityPeriod;
    private SET_CS mUse;
    private String mContactPoint;
    private static final TEL nullNI = new TELImpl(CSImpl.valueOf("NI"));
    private static final TEL nullOTH = new TELImpl(CSImpl.valueOf("OTH"));
    private static final TEL nullNINF = new TELImpl(CSImpl.valueOf("NINF"));
    private static final TEL nullPINF = new TELImpl(CSImpl.valueOf("PINF"));
    private static final TEL nullUNK = new TELImpl(CSImpl.valueOf("UNK"));
    private static final TEL nullASKU = new TELImpl(CSImpl.valueOf("ASKU"));
    private static final TEL nullNAV = new TELImpl(CSImpl.valueOf("NAV"));
    private static final TEL nullMSK = new TELImpl(CSImpl.valueOf("MSK"));
    private static final TEL nullNA = new TELImpl(CSImpl.valueOf("NA"));
    private static final TEL nullNASK = new TELImpl(CSImpl.valueOf("NASK"));

    public static TEL valueOf(CS cs, ST st, GTS gts, SET_CS set_cs)
    {
        return new TELImpl(cs, st, gts, set_cs);
    }

    public static TEL valueOf(String s, String s1, GTS gts, SET_CS set_cs)
    {
        CS cs = CSImpl.valueOf(s);
        ST st = STImpl.valueOf(s1);
        return valueOf(cs, st, gts, set_cs);
    }

    public static TEL valueOf(CS cs, ST st, GTS gts, SET_CS set_cs, String s)
    {
        TELImpl telimpl = new TELImpl(cs, st, gts, set_cs);
        telimpl.mContactPoint = s;
        return telimpl;
    }

    protected TELImpl(CS cs, ST st, GTS gts, SET_CS set_cs)
    {
        super(cs, st);
        mUsabilityPeriod = gts;
        mUse = set_cs;
        mContactPoint = null;
    }

    protected TELImpl(CS cs)
    {
        super(cs);
        mContactPoint = null;
    }

    public SET_CS use()
    {
        if(isNull().isTrue())
            return SET_CSImpl.nullSET_CS(NullFlavorImpl.NI);
        else
            return mUse;
    }

    public GTS useablePeriod()
    {
        if(isNull().isTrue())
            return GTSNullImpl.nullGTS(NullFlavorImpl.NI);
        else
            return mUsabilityPeriod;
    }

    public int hashCode()
    {
        return super.hashCode();
    }

    public BL equal(ANY any)
    {
        return super.equal(any);
    }

    public TYPE dataType()
    {
        return com.sunwayhorizo.health.hl7.datatypes.common.TYPEImpl.TEL;
    }

    public String getContactPoint()
    {
        return mContactPoint;
    }

//    public XMLNode[] writeXML(XMLDocument xmldocument, String s)
//        throws Hl7Exception
//    {
//        try
//        {
//            XMLElement xmlelement = (XMLElement)xmldocument.createElement(s);
//            if(use() != null && !use().isNull().isTrue())
//            {
//                XMLNode axmlnode[] = ((SET_CSImpl)use()).writeXML(xmldocument, "use");
//                xmlelement.setAttribute("use", axmlnode[0].getAttributes().getNamedItem("code").getNodeValue());
//            }
//            XMLNode axmlnode1[] = super.writeXML(xmldocument, "value");
//            if(axmlnode1[0] != null)
//                xmlelement.setAttribute("value", axmlnode1[0].getNodeValue());
//            if(useablePeriod() != null && !useablePeriod().isNull().isTrue())
//                xmlelement.appendChild(((GTSBase)useablePeriod()).writeXML(xmldocument, "usablePeriod")[0]);
//            return (new XMLNode[] {
//                xmlelement
//            });
//        }
//        catch(Exception exception)
//        {
//            throw new Hl7Exception(exception);
//        }
//    }

    public static TEL nullTEL(CS cs)
    {
        String s = null;
        if(cs == null || cs.literal().stringValue() == null || cs.isNull().isTrue())
            s = "NI";
        else
            s = cs.literal().stringValue();
        if(s.equals("NI"))
            return nullNI;
        if(s.equals("OTH"))
            return nullOTH;
        if(s.equals("NINF"))
            return nullNINF;
        if(s.equals("PINF"))
            return nullPINF;
        if(s.equals("UNK"))
            return nullUNK;
        if(s.equals("ASKU"))
            return nullASKU;
        if(s.equals("NAV"))
            return nullNAV;
        if(s.equals("MSK"))
            return nullMSK;
        if(s.equals("NA"))
            return nullNA;
        if(s.equals("NASK"))
            return nullNASK;
        else
            return nullNI;
    }

}
